<?php
require_once(dirname(dirname(__FILE__)) . '/app.php');

need_login();
$condition = array( 'shareid' => $login_user_id );


$selector = strval($_GET['s']);
$allow = array('index','unpay','pay','askrefund');
$cur_foot = 'mysetting';

if(isset($INI['system']['secsite']) && !empty($INI['system']['secsite']))
	$cur_url = $INI['system']['wwwprefix'].$INI['system']['secsite'].'account/myfans.php';
else 	
	$cur_url = $INI['system']['wwwprefix'].'account/myfans.php';

$count = Table::Count('user', $condition);

list($pagesize, $offset, $pagestring) = pagestring($count, 10);

$myfans = DB::LimitQuery('user', array(
	'condition' => $condition,
	'order' => 'ORDER BY  id desc',
	'size' => $pagesize,
	'offset' => $offset,
));



if(isset($_GET['page'])  && intval($_GET['page']) > 1)
{
	$s_html = '';
	$result = array('ret'=>1,'offset'=>$offset);
	if(!empty($myfans)){
		$result['ret'] = 0;
	}
	foreach($myfans as $index =>$one)
	{
		
			$s_html .= '<li>';
			$s_html .= '	<span class="pic">';
			$s_html .= '		<img src="'.$one['avatar'].'"></span>';
			$s_html .= '	<div class="text">';
			$s_html .= '		<span class="pro-name">昵称：'.$one['username'].'</span>';
			$s_html .= '		<div class="pro-pric"><span>关注时间：</span>'.date('Y-m-d',$one['create_time']).'</div>';
			$s_html .= '		<div class="pro-pric"><span>推荐上级：</span>'.$login_user['username'].'</div>';
			$s_html .= '	</div>';
			$s_html .= '</li>';
	}
	
	$result['html'] = $s_html;
	echo json_encode($result);
	die();
}


$pagetitle = '我的团员';
include template('account_myfans');
